(* *)\r
(* (C) Copyright by Lars B. Dybdahl and others *)\r
(* E-mail: Lars@dybdahl.dk, phone +45 70201241 *)\r
-(* File version: $Date: 2005-11-20 21:24:43 $ *)\r
-(* Revision: $Revision: 1.2 $ *)\r
+(* File version: $Date: 2005-12-06 00:25:47 $ *)\r
+(* Revision: $Revision: 1.3 $ *)\r
(* *)\r
(* Contributors: Peter Thornqvist, Troy Wolbrink, *)\r
(* Frank Andreas de Groot, Igor Siticov, *)\r
\r
{$ifdef MSWINDOWS}\r
Windows,\r
+ Delphi,\r
{$else}\r
Libc,\r
{$endif}\r
unit gnugettextD4;\r
-(* File version: $Date: 2005-11-20 21:28:09 $ *)\r
-(* Revision: $Revision: 1.2 $ *)\r
+(* File version: $Date: 2005-12-06 00:25:47 $ *)\r
+(* Revision: $Revision: 1.3 $ *)\r
// Delphi 5 optimized interface for gnugettext.pas\r
// This unit must only be used on Delphi 5. When you upgrade to Delphi 6 or\r
// later, you should remove this unit and replace all reference to gnugettextD5\r
\r
uses\r
Classes, TypInfo;\r
- \r
+\r
// Ansistring versions of the api\r
function _(const szMsgId: string): string;\r
function gettext(const szMsgId: string): string;\r
function IncludeTrailingBackSlash(const Path: string): string;\r
function ExcludeTrailingBackslash(const Path: string): string;\r
\r
-function GetStrProp(Instance: TObject; const Name: string): string; overload;\r
-function GetStrProp(Instance: TObject; Info: PPropInfo): string; overload;\r
-procedure SetStrProp(Instance: TObject; const Name, Value: string); overload;\r
-procedure SetStrProp(Instance: TObject; Info: PPropInfo; const Value: string); overload;\r
-\r
implementation\r
\r
uses\r
SetString(Result, PChar(Path), Len);\r
end;\r
\r
-function GetPropInfo(Instance: TObject; const Name: string; var PropInfo: TPropInfo): Boolean;\r
-var\r
- Props: PPropList;\r
- TypeData: PTypeData;\r
- Info: PPropInfo;\r
- i: Integer;\r
-begin\r
- TypeData := GetTypeData(Instance.ClassInfo);\r
- if ((TypeData <> nil) and (TypeData^.PropCount > 0)) then\r
- begin\r
- GetMem(Props, TypeData^.PropCount * sizeof(Pointer));\r
- try\r
- GetPropInfos(Instance.ClassInfo, Props);\r
- for i := 0 to TypeData.PropCount - 1 do\r
- begin\r
- Info := Props[i];\r
- if (AnsiCompareText(Info.Name, Name) = 0) then\r
- begin\r
- PropInfo := Info^;\r
- Result := True;\r
- Exit;\r
- end\r
- end;\r
- finally\r
- FreeMem(Props);\r
- end;\r
- end;\r
- Result := False;\r
-end;\r
-\r
-function GetStrProp(Instance: TObject; Info: PPropInfo): string;\r
-begin\r
- Result := TypInfo.GetStrProp(Instance, Info);\r
-end;\r
-\r
-function GetStrProp(Instance: TObject; const Name: string): string;\r
-var\r
- Info: TPropInfo;\r
-begin\r
- if GetPropInfo(Instance, Name, Info) then\r
- Result := TypInfo.GetStrProp(Instance, @Info)\r
- else\r
- Result := '';\r
-end;\r
-\r
-procedure SetStrProp(Instance: TObject; const Name, Value: string);\r
-var\r
- Info: TPropInfo;\r
-begin\r
- if GetPropInfo(Instance, Name, Info) then\r
- SetStrProp(Instance, @Info, Value);\r
-end;\r
-\r
-procedure SetStrProp(Instance: TObject; Info: PPropInfo; const Value: string);\r
-begin\r
- TypInfo.SetStrProp(Instance, Info, Value);\r
-end;\r
-\r
end.\r
function dgettext(const szDomain: string; const szMsgId: string): string;\r
procedure TranslateComponent(AnObject: TComponent);\r
\r
-{$IFDEF VER120}\r
-function GetStrProp(Instance: TObject; const Name: string): string; overload;\r
-function GetStrProp(Instance: TObject; Info: PPropInfo): string; overload;\r
-procedure SetStrProp(Instance: TObject; const Name, Value: string); overload;\r
-procedure SetStrProp(Instance: TObject; Info: PPropInfo; const Value: string); overload;\r
-{$ENDIF}\r
-\r
implementation\r
\r
function _(const szMsgId: string): string;\r
{$ENDIF}{$ENDIF}\r
end;\r
\r
-{$IFDEF VER120}\r
-function GetStrProp(Instance: TObject; const Name: string): string;\r
-begin\r
- Result := gnugettextD4.GetStrProp(Instance, Name);\r
-end;\r
-\r
-function GetStrProp(Instance: TObject; Info: PPropInfo): string;\r
-begin\r
- Result := gnugettextD4.GetStrProp(Instance, Info);\r
-end;\r
-\r
-procedure SetStrProp(Instance: TObject; const Name, Value: string);\r
-begin\r
- gnugettextD4.SetStrProp(Instance, Name, Value);\r
-end;\r
-\r
-procedure SetStrProp(Instance: TObject; Info: PPropInfo; const Value: string);\r
-begin\r
- gnugettextD4.SetStrProp(Instance, Info, Value);\r
-end;\r
-\r
-{$ENDIF}\r
-\r
end.\r